package com.g8.pethospitallearnbackend.mapper;

import com.g8.pethospitallearnbackend.entity.EmailCode;
import com.g8.pethospitallearnbackend.entity.EmailCodeExample;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

public interface EmailCodeMapper {
    @SelectProvider(type=EmailCodeSqlProvider.class, method="countByExample")
    long countByExample(EmailCodeExample example);

    @DeleteProvider(type=EmailCodeSqlProvider.class, method="deleteByExample")
    int deleteByExample(EmailCodeExample example);

    @Insert({
        "insert into email_code (email, code)",
        "values (#{email,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR})"
    })
    int insert(EmailCode record);

    @InsertProvider(type=EmailCodeSqlProvider.class, method="insertSelective")
    int insertSelective(EmailCode record);

    @SelectProvider(type=EmailCodeSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="email", property="email", jdbcType=JdbcType.VARCHAR),
        @Result(column="code", property="code", jdbcType=JdbcType.VARCHAR)
    })
    List<EmailCode> selectByExample(EmailCodeExample example);

    @UpdateProvider(type=EmailCodeSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") EmailCode record, @Param("example") EmailCodeExample example);

    @UpdateProvider(type=EmailCodeSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") EmailCode record, @Param("example") EmailCodeExample example);
}